home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue41 / Diagram / CaptionEditForm.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-11-06  |  1.1 KB  |  55 lines

  1. unit CaptionEditForm;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls;
  8.  
  9. type
  10.   TCaptionEditDlg = class(TForm)
  11.     Label1: TLabel;
  12.     OkBtn: TButton;
  13.     CancelBtn: TButton;
  14.     CaptionEdit: TMemo;
  15.     FontBtn: TButton;
  16.     FontDialog1: TFontDialog;
  17.     procedure FontBtnClick(Sender: TObject);
  18.   private
  19.   public
  20.     class procedure NewCaption(var TheCaption : string;TheFont : TFont);
  21.   end;
  22.  
  23.  
  24. implementation
  25.  
  26. {$R *.DFM}
  27.  
  28. class procedure TCaptionEditDlg.NewCaption(var TheCaption : string;TheFont : TFont);
  29. begin {NewCaption}
  30.   with TCaptionEditDlg.Create(Application) do begin
  31.     try
  32.       CaptionEdit.Text := TheCaption;
  33.       FontDialog1.Font := TheFont;
  34.  
  35.       if ShowModal = mrOk then begin
  36.         TheCaption := CaptionEdit.Text;
  37.         TheFont.Assign(CaptionEdit.Font);
  38.       end;
  39.     finally
  40.       Release;
  41.     end;
  42.   end;
  43. end;  {NewCaption}
  44.  
  45.  
  46. procedure TCaptionEditDlg.FontBtnClick(Sender: TObject);
  47. begin
  48.   if FontDialog1.Execute then begin
  49.     CaptionEdit.Font := FontDialog1.Font;
  50.   end;
  51. end;
  52.  
  53.  
  54. end.
  55.